//
//  BSSocketHandler.m
//  BSProject
//
//  Created by nsm on 2019/8/8.
//  Copyright © 2019 beisheng. All rights reserved.
//

#import "BSSocketHandler.h"


int DataToInt(NSData *data, int idx, int len) {
    if ((idx+len) > data.length) return 0;
    NSData *subData = [data subdataWithRange:NSMakeRange(idx, len)];
    return (*(int *)(subData.bytes));
}

NSString *DataToString(const void *data) {
    NSString *str = [[NSString alloc] initWithBytes:data
                                             length:sizeof(data)
                                           encoding:NSUTF8StringEncoding];
    return SafeString(str);
}

@implementation BSSocketHandler

@end
